import React, { lazy, Suspense } from "react";
// import { Navigate, ,  } from "react-router-dom";
import { Navigate } from "react-router-dom";
const Home = lazy(() => import("@/views/home/index"));
// const ChildContainer = lazy(() => import("@/views/child-public-container/index"));
// const NotFind = lazy(() => import("@/views/not-find/index"));
import ChildContainer from "@/views/child-public-container/index";

// 路由懒加载的封装
// 路由懒加载的封装
const LazyLoad = (path: string) => {
  const Comp = lazy(() => import(`../views/${path}`));
  return (
    <Suspense fallback={<>加载中..111.</>}>
      <Comp />
    </Suspense>
  );
};

const routes = [
  //配置/重定向路由
  {
    path: "/",
    element: <Navigate to="/home" replace />, //路由重定向
  },
  {
    path: "/home",
    element: <Home />,
  },
  {
    path: '/ssii-common/:chapters*',
    element: <ChildContainer/>
  },

  // 匹配不到的路由都展示404页面
  // {
  //   path: "*",
  //   // element: <NotFind />,
  //   element: LazyLoad("not-find/index"),
  // },
];

export default routes;
